import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/direction',
      name: 'direction',
      component: () => import('../views/ShowDirectionView.vue')
    },
    {
      path: '/map',
      name: 'map',
      component: () => import('../views/StudyMapView.vue')
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/user',
      name: 'user',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/UserView.vue')
    },
    {
      path: '/learn/:type?',
      name: 'learn',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/LearningView.vue')
    },
    {
      path: '/qa/:type?',
      name: 'qa',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/Q&AView.vue')
    },
    {
      path: '/blog',
      name: 'blog',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/BlogListView.vue')
    },
    {
      path: '/blog/write/:id?',
      name: 'write_blog',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/WriteBlog.vue')
    },
    {
      path: '/blogview/:id?',
      name: 'blogview',
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/BlogDetailView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/:pathMatch(.*)*',
      name: 'all',
      component: () => import('../views/404.vue')
    }
  ]
})


export default router
